<?php

namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Input;
use \App\Admin\Item_tags;

class Item_tagsController extends Controller
{
    public function getOne(){
        $item_id = Input::get('item_id');
        $res = Item_tags::where('item_id',$item_id) -> first();
        return response() -> json($res);
    }

    public function edit(){
        $data = Input::all();
        $result = Item_tags::where('item_id',$data['item_id']) -> update([
            'tag' => $data['tag'],
            'img' => $data['img'],
        ]);
        session('tags_img_url',null);
        return $result ? '1' : '0';
    }
}